<template>
  <div class="execution">
    <basic-container>
      <div style="display: flex;">
        <div>
          <el-form ref="dataForm" :model="dataForm" :rules="rules" label-width="120px">
            <!--<el-form-item label="订单支付" prop="orderPayTem">-->
            <!--<el-input v-model="dataForm.orderPayTem" style="width: 400px" placeholder="请输入模板ID"></el-input>-->
            <!--</el-form-item>-->
            <el-form-item label="新订单通知" prop="orderNewTem">
              <el-input v-model="dataForm.orderNewTem" style="width: 400px" placeholder="请输入模板ID">
              </el-input>
            </el-form-item>
            <el-form-item label="订单取消" prop="orderCancelTem">
              <el-input v-model="dataForm.orderCancelTem" style="width: 400px" placeholder="请输入模板ID">
              </el-input>
            </el-form-item>
            <el-form-item label="接单成功" prop="orderSendTem">
              <el-input v-model="dataForm.orderSendTem" style="width: 400px" placeholder="请输入模板ID">
              </el-input>
            </el-form-item>
            <el-form-item label="提现成功" prop="drawSuccessTem">
              <el-input v-model="dataForm.drawSuccessTem" style="width: 400px" placeholder="请输入模板ID">
              </el-input>
            </el-form-item>
            <el-form-item label="提现失败" prop="drawFailTem">
              <el-input v-model="dataForm.drawFailTem" style="width: 400px" placeholder="请输入模板ID">
              </el-input>
            </el-form-item>
            <!--<el-form-item label="提现申请成功" prop="drawApplySuccessTem">-->
              <!--<el-input v-model="dataForm.drawApplySuccessTem" style="width: 400px" placeholder="请输入模板ID">-->
              <!--</el-input>-->
            <!--</el-form-item>-->
            <!--<el-form-item label="提现申请失败" prop="drawApplyRejectTem">-->
              <!--<el-input v-model="dataForm.drawApplyRejectTem" style="width: 400px" placeholder="请输入模板ID">-->
              <!--</el-input>-->
            <!--</el-form-item>-->
            <el-form-item>
              <el-button type="primary" @click="onSubmit" :loading="loading">保存</el-button>
              <el-button @click="getList()">取消</el-button>
            </el-form-item>
          </el-form>
        </div>
        <div style="margin-left: 50px"><img src="/static/img/temp1.png" width="400" /><img src="/static/img/temp2.png" width="400"/></div>
      </div>
    </basic-container>
  </div>
</template>

<script>
  import {getMessateTemConfig, saveMessageTem} from '@/api/admin/config'
  export default {
    name: 'config',
    data() {
      return {
        dataForm:{},
        loading: false,
        rules:{
          orderPayTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          orderNewTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          orderCancelTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          orderSendTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          drawSuccessTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          drawFailTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          drawApplySuccessTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ],
          drawApplyRejectTem: [
            { required: true, message: '请填写模板ID', trigger: 'blur' }
          ]
        }
      }
    },
    mounted: function () {
      this.getList()
    },
    methods: {
      getList() {
        getMessateTemConfig().then(response => {
          this.dataForm = response.data.data
        })
      },
      /**
       * @title 数据添加
       * @param row 为当前的数据
       * @param done 为表单关闭函数
       *
       **/
      onSubmit() {
        this.loading = true
        const data = new FormData()
        data.append('paramValue',JSON.stringify(this.dataForm))
        saveMessageTem(data).then(res => {
          this.loading = false
          this.$message({
            showClose: true,
            message: '保存成功',
            type: 'success'
          })
          this.getList()
        })
      },
//      /**
//       * 刷新回调
//       */
//      refreshChange() {
//        this.getList(this.page)
//      }
    }
  }
</script>

<style lang="scss" scoped>
</style>
